Sanshi (a government post) (算師)
Sanshi is a government post in charge of calculation in the Ritsuryo system (a system of centralized government based on the ritsuryo code). It was established in the Kazueryo (Account Office), the Shuzeiryo (Bureau of Taxation), Dazai-fu (local government office in Kyushu) and later in the Shurishiki (Office of Palace Affairs) and Mokuryo (Bureau of Carpentry).
Two sanshi were appointed to both the Kazueryo and Shuzeiryo, and their equivalent rank was Juhachinoge (Junior Eighth Rank, Lower Grade). Each person at the post calculated the tax coming into the capital and the amount spent. One person was in charge of totaling the amount of the soyochoyo (labor or alternative goods collected as tax) and soyouchocho (textiles collected as tax) and the calculation of the yodo (supplies), while the other person totaled the soyochoso (rice collected as tax). Their ranks were equivalent to Juhachinoge and in 719 they were given permission to carry a shaku (wooden mace).
One person was appointed to the Daizafu (become 2 people from 814 onwards) and their rank was equivalent to Juhachinoge. This person's totaled-up the taxes for the entire Kyushu area and in 822 he it became mandatory for this person to bring the tax accounts to the capital and report them.
A sanshi post was established in the Shurikishi in 822, then in the Mokuryo (the exact year of the latter is unknown, but it was before the compilation of the Engishiki (an ancient book of codes and procedures)). One person was appointed to each of the posts, and their treatments, including their rank, were set to the same as those at Kazueryo and Shuzeiryo.
In addition, a Sanshi post was sometimes placed also in each of the fields of finance, civil engineering and construction as Ryoge no kan (class outside of the Ritsuryo system). In the early Nara period, a Sanshi post was placed in the construction ministry that was established for the construction of Heijo-kyo Capital. It is recorded how in 755, four people were appointed as sanshi in both Sakyo and Ukyo (the areas to the right and left of Heijokyo (the ancient capital), as well as in the Kawachi, Settsu and Yamashiro provinces; this was done to ensure the smooth implementation of the Handen Shujo law (a law for periodically reallocation rice land). A Sanshi post was sometimes provided to determine boundaries among handen (allotted farmlands), Koden (fields administered directly by a ruler) and Shoen (manors) or to design buildings, gardens, etc.
Two San Hakase (Doctor of Numbers) were responsible for training the sanshi at the Daigakuryo (Bureau of Education). 30 students (known as sansho) took classes using the Kyushosanjutsu and the Shuhisankei (Chinese mathematics books) as textbooks, and a prescribed number of students who passed the test were appointed to sanshi posts. However, it is likely that the necessity of advanced mathematics was not recognized keenly in Japan at that time, and it is said that what was learned was only basic pragmatical arithmetic and no advanced mathematics were involved.